//package com.zero.cloud.gateway.config;
//
//import org.springframework.boot.autoconfigure.web.ServerProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.Ordered;
//import org.springframework.core.annotation.Order;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.server.reactive.ServerHttpRequest;
//import org.springframework.web.server.ResponseStatusException;
//import org.springframework.web.server.WebFilter;
//
///**
// * @author MARCH
// * @className GatewayConfig
// * @description
// * @date 2025/6/3 21:43
// */
//@Configuration
//public class GatewayConfig {
//    @Bean
//    @Order(Ordered.HIGHEST_PRECEDENCE)
//    public WebFilter contextPathWebFilter(ServerProperties serverProperties){
//        String contextPath = serverProperties.getServlet().getContextPath();
//
//        return (serverWebExchange, webFilterChain) ->{
//            ServerHttpRequest request = serverWebExchange.getRequest();
//            String requestPath = request.getURI().getPath();
//            ServerHttpRequest newRequest = request.mutate()
//                    .path(requestPath).build();
//            return webFilterChain.filter(serverWebExchange.mutate()
//                    .request(newRequest)
//                    .build()
//            );
//
//        };
//    }
//}
